// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_EnergyCalculator1.xml
    
    public class EnergyCalculator1Service : MiosService
    {
        #region DaysOfWeek : String;
        private String _mDaysOfWeek;
        
        public String DaysOfWeek
        {
            get
            {
                return _mDaysOfWeek ?? GetDaysOfWeek();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetDaysOfWeek() : String;
        public String GetDaysOfWeek()
        {
            _mDaysOfWeek = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "DaysOfWeek"));
            
            return _mDaysOfWeek;
        }
        #endregion Action GetDaysOfWeek
        
        #endregion
        
        #region Time : String;
        private String _mTime;
        
        public String Time
        {
            get
            {
                return _mTime ?? GetTime();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetTime() : String;
        public String GetTime()
        {
            _mTime = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Time"));
            
            return _mTime;
        }
        #endregion Action GetTime
        
        #endregion
        
        #region LightsOn : Byte;
        private Byte? _mLightsOn;
        
        public Byte LightsOn
        {
            get
            {
                return _mLightsOn ?? GetLightsOn();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetLightsOn() : Byte;
        public Byte GetLightsOn()
        {
            _mLightsOn = FromLuupByte(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "LightsOn"));
            
            return _mLightsOn.Value;
        }
        #endregion Action GetLightsOn
        
        #endregion
        
        #region ThermostatOn : Boolean;
        private Boolean? _mThermostatOn;
        
        public Boolean ThermostatOn
        {
            get
            {
                return _mThermostatOn ?? GetThermostatOn();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetThermostatOn() : Boolean;
        public Boolean GetThermostatOn()
        {
            _mThermostatOn = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "ThermostatOn"));
            
            return _mThermostatOn.Value;
        }
        #endregion Action GetThermostatOn
        
        #endregion
        
        #region MaxWatts : UInt32;
        private UInt32? _mMaxWatts;
        
        public UInt32 MaxWatts
        {
            get
            {
                return _mMaxWatts ?? GetMaxWatts();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetMaxWatts() : UInt32;
        public UInt32 GetMaxWatts()
        {
            _mMaxWatts = FromLuupUInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "MaxWatts"));
            
            return _mMaxWatts.Value;
        }
        #endregion Action GetMaxWatts
        
        #endregion
        
        #region Users : String;
        private String _mUsers;
        
        public String Users
        {
            get
            {
                return _mUsers ?? GetUsers();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetUsers() : String;
        public String GetUsers()
        {
            _mUsers = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Users"));
            
            return _mUsers;
        }
        #endregion Action GetUsers
        
        #endregion
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "DaysOfWeek":
                    _mDaysOfWeek = FromLuupString(value); return true;
                case "LightsOn":
                    _mLightsOn = FromLuupByte(value); return true;
                case "MaxWatts":
                    _mMaxWatts = FromLuupUInt32(value); return true;
                case "ThermostatOn":
                    _mThermostatOn = FromLuupBoolean(value); return true;
                case "Time":
                    _mTime = FromLuupString(value); return true;
                case "Users":
                    _mUsers = FromLuupString(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public EnergyCalculator1Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

